﻿#include "BackEnd.h"
#include <QQmlEngine>
#include "Macro.h"
#include <assert.h>

QObject* BackEnd::spInstance = 0;

BackEnd::BackEnd(QObject* parent)
: QObject(parent)
, mDB(this)
{
	Init();
}
BackEnd::~BackEnd(){

}
QObject* BackEnd::Provider(QQmlEngine*, QJSEngine*){
	assert(spInstance);
    QQmlEngine::setObjectOwnership(spInstance,QQmlEngine::CppOwnership);
	return spInstance;
}
void BackEnd::Init(){
    spInstance = this;
	InitMods();
	BindSignal();
	RegisterQmlType();
}
void BackEnd::RegisterQmlType(){
	qmlRegisterSingletonType<BackEnd>("BackEnd",1,0,"BE",BackEnd::Provider);
}
void BackEnd::InitMods(){
	// 将所有类型注入到Mods容器中
	mMods.AddRef(mDB);

	// 将Mods容器派发给所有模块，让模块之间可以互相使用

	// 注入Mods之后的初始化操作

}
void BackEnd::BindSignal(){

}


